import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'jobState'
})
export class JobStatePipe implements PipeTransform {

  transform(value: any, args?: any): any {
    if(!value) return value;
    if(typeof value !== 'string') throw new Error("invalid argument for jobState")
    if(args == 'color') {
      if(value == 'PAUSED')
      return "orange";
    }
    if(value == 'PAUSED') {
      return "暂停中"
    }
    return null;
  }

}
